package com.commerce.img.fragemt;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

import com.android.volley.toolbox.NetworkImageView;
import com.commerce.img.MyAppData;
import com.commerce.img.R;
import com.commerce.img.tools.MyImgLoader;


public class BlankFragment extends Fragment {

    private String url;
    MyAppData myAppData;
    private NetworkImageView imageView;

    public BlankFragment(String url,MyAppData myAppData) {
       this.url = url;
       this.myAppData = myAppData;
    }

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
                             @Nullable Bundle savedInstanceState) {
        return initView(inflater,container);
    }

    private View initView(LayoutInflater inflater, ViewGroup container) {
        View view = inflater.inflate(R.layout.fragment_blank, container, false);
        imageView = view.findViewById(R.id.fbk_image);
        imageView.setImageResource(R.drawable.wall);
        new MyImgLoader(getActivity(),imageView,url).inBitmap();
        return view;
    }

    @Override
    public void onResume() {
        myAppData.setImageView(imageView);
        super.onResume();
    }
}